home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / gnu / emacs_src_18_58.lha / emacs-18.58 / lisp / scheme.elc < prev    next >
Text File  |  1992-02-21  |  11KB  |  137 lines

  1.  
  2. (provide (quote scheme))
  3.  
  4. (defvar scheme-mode-syntax-table nil "\
  5. ")
  6.  
  7. (if (not scheme-mode-syntax-table) (let ((i 0)) (setq scheme-mode-syntax-table (make-syntax-table)) (set-syntax-table scheme-mode-syntax-table) (while (< i 256) (modify-syntax-entry i "_   ") (setq i (1+ i))) (setq i 48) (while (<= i 57) (modify-syntax-entry i "w   ") (setq i (1+ i))) (setq i 65) (while (<= i 90) (modify-syntax-entry i "w   ") (setq i (1+ i))) (setq i 97) (while (<= i 122) (modify-syntax-entry i "w   ") (setq i (1+ i))) (modify-syntax-entry 9 "    ") (modify-syntax-entry 10 ">   ") (modify-syntax-entry 12 "    ") (modify-syntax-entry 13 "    ") (modify-syntax-entry 32 "    ") (modify-syntax-entry 91 "(]  ") (modify-syntax-entry 93 ")[  ") (modify-syntax-entry 123 "(}  ") (modify-syntax-entry 125 "){  ") (modify-syntax-entry 124 "    ") (modify-syntax-entry 40 "()  ") (modify-syntax-entry 41 ")(  ") (modify-syntax-entry 59 "<   ") (modify-syntax-entry 34 "\"    ") (modify-syntax-entry 39 "'   ") (modify-syntax-entry 96 "'   ") (modify-syntax-entry 44 "'   ") (modify-syntax-entry 64 "'   ") (modify-syntax-entry 35 "'   ") (modify-syntax-entry 92 "\\   ")))
  8.  
  9. (defvar scheme-mode-abbrev-table nil "\
  10. ")
  11.  
  12. (define-abbrev-table (quote scheme-mode-abbrev-table) nil)
  13.  
  14. (defun scheme-mode-variables nil (byte-code "Î!ˆ
  15. ‰ˆÏÃ!ˆÐ P‰ˆÏÅ!ˆ ‰ˆÏÆ!ˆÇ‰ˆÏÈ!ˆÑ‰ˆÏÉ!ˆÒ‰    ˆÏÊ!ˆÓ‰
  16. ˆÏË!ˆÔ‰ ˆÏÌ!ˆÕ‰ ˆÖ‰‡" [scheme-mode-syntax-table local-abbrev-table scheme-mode-abbrev-table paragraph-start page-delimiter paragraph-separate paragraph-ignore-fill-prefix t indent-line-function comment-start comment-start-skip comment-column comment-indent-hook mode-line-process set-syntax-table make-local-variable "^$\\|" scheme-indent-line ";" ";+[     ]*" 40 scheme-comment-indent ("" scheme-mode-line-process)] 11))
  17.  
  18. (defvar scheme-mode-line-process "")
  19.  
  20. (defun scheme-mode-commands (map) (byte-code "ÁÂÃ#ˆÁÄÅ#ˆÁÆÇ#‡" [map define-key "    " scheme-indent-line "" backward-delete-char-untabify "" scheme-indent-sexp] 6))
  21.  
  22. (defvar scheme-mode-map nil)
  23.  
  24. (if (not scheme-mode-map) (progn (setq scheme-mode-map (make-sparse-keymap)) (scheme-mode-commands scheme-mode-map)))
  25.  
  26. (defun scheme-mode nil "\
  27. Major mode for editing Scheme code.
  28. Editing commands are similar to those of lisp-mode.
  29.  
  30. In addition, if an inferior Scheme process is running, some additional
  31. commands will be defined, for evaluating expressions and controlling
  32. the interpreter, and the state of the process will be displayed in the
  33. modeline of all Scheme buffers.  The names of commands that interact
  34. with the Scheme process start with \"xscheme-\".  For more information
  35. see the documentation for xscheme-interaction-mode.
  36.  
  37. Commands:
  38. Delete converts tabs to spaces as it moves back.
  39. Blank lines separate paragraphs.  Semicolons start comments.
  40. \\{scheme-mode-map}
  41. Entry to this mode calls the value of scheme-mode-hook
  42. if that value is non-nil." (interactive) (byte-code "ÀˆÁ ˆÂ ˆÃ ˆÄÅ!‡" [nil kill-all-local-variables scheme-mode-initialize scheme-mode-variables run-hooks scheme-mode-hook] 5))
  43.  
  44. (defun scheme-mode-initialize nil (byte-code "Ã!ˆÄ‰ˆÅ‰‡" [scheme-mode-map major-mode mode-name use-local-map scheme-mode "Scheme"] 3))
  45.  
  46. (defvar scheme-mit-dialect t "\
  47. If non-nil, scheme mode is specialized for MIT Scheme.
  48. Set this to nil if you normally use another dialect.")
  49.  
  50. (defun scheme-comment-indent (&optional pos) (byte-code "Š…bˆÄÅ!ƒi‚:ÄÆ!ƒ*Ç     <ƒ%    @‚&    )‚:ÈÉ!ˆnƒ6ʂ8iT ])‡" [pos tem t comment-column looking-at ";;;" ";;" calculate-scheme-indent skip-chars-backward "     " 0] 6))
  51.  
  52. (defvar scheme-indent-offset nil "\
  53. ")
  54.  
  55. (defvar scheme-indent-hook (quote scheme-indent-hook) "\
  56. ")
  57.  
  58. (defun scheme-indent-line (&optional whole-exp) "\
  59. Indent current line as Scheme code.
  60. With argument, indent any additional lines of the same expression
  61. rigidly along with this one." (interactive "P") (byte-code "ňǠÅÅÅd`ZÈ ˆ`‰ˆÉÊ!ˆËÌ!ƒ$ł‚<…-@‰ˆiZ‰ˆÍ    !ƒ>łEÎ
  62. `\"ˆjˆd Z`V…Rd Zbˆ…‚Í    !?…‚Š
  63. bˆÏÐ!ˆ`‰ˆ
  64. bˆÑÐ!ˆ`‰ˆ
  65. V)…‚Ò
  66.     #-‡" [indent shift-amt beg end pos nil whole-exp calculate-scheme-indent beginning-of-line skip-chars-forward "     " looking-at "[     ]*;;;" zerop delete-region forward-sexp 1 forward-line indent-code-rigidly] 13))
  67.  
  68. (defun calculate-scheme-indent (&optional parse-start) "\
  69. Return appropriate indentation for current line as scheme code.
  70. In usual case returns an integer: the column to indent to.
  71. Can instead return a list, whose car is the column to indent to.
  72. This means that following lines at the same level of indentation
  73. should not necessarily be indented the same way.
  74. The second element of the list is the buffer position
  75. of the start of the containing expression." (byte-code "ŠÎ ˆ`ÊÊÊÅÊÊÊ    ƒ\"    b‚$Ï ˆ`W…6Ð`Ñ#‰ˆ‚%ˆ …E    @‰…E
  76. ÑV…êʉˆÒ    8‰ˆ    A@‰ˆTbˆ…h`V…ÐÑ#  A@‰…€ ‰)ˆ ?…æTbˆ?ƒ˜i‰‚æÐ`ÑÅ$ˆÓÔ!‰ˆŠÕÖ!ˆ`)VƒÕÐ`ÑÅ$ˆ×`\"…ÏØÖ!ˆÐ`ÑÅ$ˆÙ ‚æbˆÎ ˆÐ`ÑÅ$ˆÙ ˆ‚7ˆ…ói‰ˆÚÛ    \"@ƒ    bˆÜÝ!ˆi‰‚EÞ !…ƒ\"bˆ i\\‰‚E †>ßÍ!…>…> ?…>à    #‰?…Ei‰ˆ .)‡" [indent-point state paren-depth desired-indent retry t last-sexp containing-sexp first-sexp-list-p parse-start nil peek scheme-indent-offset scheme-indent-hook beginning-of-line beginning-of-defun parse-partial-sexp 0 2 looking-at "\\s(" forward-line 1 /= forward-sexp backward-prefix-chars nthcdr 3 skip-chars-forward "     " integerp boundp funcall] 23))
  77.  
  78. (defun scheme-indent-hook (indent-point state) (byte-code "iŠ    A@TbˆÅÆ!ˆÇ`    A@\"…cÈÉÊ!ˆ`ËÌ!ˆ`\"ÍÎ
  79. !‰ˆÏ
  80. !ÐN‰ˆÑ !ƒAÒ      #‚b ƒMÓ      #‚b
  81. GÔV…[Õ
  82. ÖÔO×\"…bØ     \"*))‡" [normal-indent state function method indent-point re-search-forward "\\sw\\|\\s_" /= buffer-substring forward-char -1 forward-sexp 1 nil downcase intern-soft scheme-indent-hook integerp scheme-indent-specform funcall 3 string-equal 0 "def" scheme-indent-defform] 14))
  83.  
  84. (defvar scheme-body-indent 2 "\
  85. ")
  86.  
  87. (defun scheme-indent-specform (count state indent-point) (byte-code "    A@ ÊÊbˆi‰ˆ\\‰ˆËÌ!ˆÍÌ!ˆÎ`ÌÈ$ˆ`W…3ÊÏЏ…;ʈ‚(ˆ ÑVƒNÒÓ\"\\D‚g ÑU…^
  88. ÑU†^     Xƒe ‚g    ,‡" [containing-form-start state i count body-indent containing-form-column scheme-body-indent indent-point t normal-indent nil forward-char 1 forward-sexp parse-partial-sexp (byte-code "S‰ˆÃÄ!ˆÅ`    ÄÂ$‡" [count indent-point t forward-sexp 1 parse-partial-sexp] 6) ((error (byte-code "À‡" [nil] 1))) 0 * 2] 7))
  89.  
  90. (defun scheme-indent-defform (state indent-point) (byte-code "A@bˆÂÃ!ˆ`AA@V…A@bˆ    i\\‡" [state scheme-body-indent forward-line 1] 3))
  91.  
  92. (defun would-be-symbol (string) (byte-code "ÁÂÃOÄ\"?‡" [string string-equal 0 1 "("] 4))
  93.  
  94. (defun next-sexp-as-string nil (byte-code "ÁÂ!ˆ`ÃÂ!ˆÄ`\")‡" [the-end forward-sexp 1 backward-sexp buffer-substring] 5))
  95.  
  96. (defun scheme-let-indent (state indent-point) (byte-code "ÂÃ!ˆÄÅ!ƒÆÇ    #‚ÆÈ    #‡" [state indent-point skip-chars-forward "     " looking-at "[a-zA-Z0-9+-*/?!@$%^&_:~]" scheme-indent-specform 2 1] 7))
  97.  
  98. (put (quote begin) (quote scheme-indent-hook) 0)
  99.  
  100. (put (quote case) (quote scheme-indent-hook) 1)
  101.  
  102. (put (quote delay) (quote scheme-indent-hook) 0)
  103.  
  104. (put (quote do) (quote scheme-indent-hook) 2)
  105.  
  106. (put (quote lambda) (quote scheme-indent-hook) 1)
  107.  
  108. (put (quote let) (quote scheme-indent-hook) (quote scheme-let-indent))
  109.  
  110. (put (quote let*) (quote scheme-indent-hook) 1)
  111.  
  112. (put (quote letrec) (quote scheme-indent-hook) 1)
  113.  
  114. (put (quote sequence) (quote scheme-indent-hook) 0)
  115.  
  116. (put (quote call-with-input-file) (quote scheme-indent-hook) 1)
  117.  
  118. (put (quote with-input-from-file) (quote scheme-indent-hook) 1)
  119.  
  120. (put (quote with-input-from-port) (quote scheme-indent-hook) 1)
  121.  
  122. (put (quote call-with-output-file) (quote scheme-indent-hook) 1)
  123.  
  124. (put (quote with-output-to-file) (quote scheme-indent-hook) 1)
  125.  
  126. (put (quote with-output-to-port) (quote scheme-indent-hook) 1)
  127.  
  128. (if scheme-mit-dialect (progn (put (quote fluid-let) (quote scheme-indent-hook) 1) (put (quote in-package) (quote scheme-indent-hook) 1) (put (quote let-syntax) (quote scheme-indent-hook) 1) (put (quote local-declare) (quote scheme-indent-hook) 1) (put (quote macro) (quote scheme-indent-hook) 1) (put (quote make-environment) (quote scheme-indent-hook) 0) (put (quote named-lambda) (quote scheme-indent-hook) 1) (put (quote using-syntax) (quote scheme-indent-hook) 1) (put (quote with-input-from-string) (quote scheme-indent-hook) 1) (put (quote with-output-to-string) (quote scheme-indent-hook) 0) (put (quote with-values) (quote scheme-indent-hook) 1) (put (quote syntax-table-define) (quote scheme-indent-hook) 2) (put (quote list-transform-positive) (quote scheme-indent-hook) 1) (put (quote list-transform-negative) (quote scheme-indent-hook) 1) (put (quote list-search-positive) (quote scheme-indent-hook) 1) (put (quote list-search-negative) (quote scheme-indent-hook) 1) (put (quote access-components) (quote scheme-indent-hook) 1) (put (quote assignment-components) (quote scheme-indent-hook) 1) (put (quote combination-components) (quote scheme-indent-hook) 1) (put (quote comment-components) (quote scheme-indent-hook) 1) (put (quote conditional-components) (quote scheme-indent-hook) 1) (put (quote disjunction-components) (quote scheme-indent-hook) 1) (put (quote declaration-components) (quote scheme-indent-hook) 1) (put (quote definition-components) (quote scheme-indent-hook) 1) (put (quote delay-components) (quote scheme-indent-hook) 1) (put (quote in-package-components) (quote scheme-indent-hook) 1) (put (quote lambda-components) (quote scheme-indent-hook) 1) (put (quote lambda-components*) (quote scheme-indent-hook) 1) (put (quote lambda-components**) (quote scheme-indent-hook) 1) (put (quote open-block-components) (quote scheme-indent-hook) 1) (put (quote pathname-components) (quote scheme-indent-hook) 1) (put (quote procedure-components) (quote scheme-indent-hook) 1) (put (quote sequence-components) (quote scheme-indent-hook) 1) (put (quote unassigned\?-components) (quote scheme-indent-hook) 1) (put (quote unbound\?-components) (quote scheme-indent-hook) 1) (put (quote variable-components) (quote scheme-indent-hook) 1)))
  129.  
  130. (defun scheme-indent-sexp nil "\
  131. Indent each line of the list starting just after point." (interactive) (byte-code "ÁˆÁCÌÁÁÁÁÁŠÍÎ!)ˆŠÁ‰ˆ ?….
  132. Á‰    ˆ    ?…5m‰?……Ï`Рˆ`ÁÁ%‰ˆ@‰ˆÑÒ\"@…dÓ ˆÐ ˆÔÑÒ\"Á\"ˆÑÕ\"@ƒ}ÖÎ!ˆÔÑ×\"Á\"‚Ê‰    ˆ‚+ˆ
  133. ÌX‰ƒ’Á‚*
  134. V…¦AS‰ˆ‚’ˆ
  135. W…¼ÁBT‰ˆ‚§ˆÖÎ!ˆ`‰ˆØÙ!ˆm†ÐÚÛ!ƒ×Á‚*@…à@ÌYƒë@‰‚Ü@…ô@[! Ý !ƒ    Ô ‰\"‚Ô A@[\"ˆ @‰)ˆÞi\"…*ß `\"ˆjˆ‚).‡" [indent-stack nil next-depth bol outer-loop-done inner-loop-done state this-indent last-depth innerloop-done t val 0 forward-sexp 1 parse-partial-sexp end-of-line nthcdr 4 indent-for-comment setcar 3 forward-line 5 skip-chars-forward "     " looking-at "[;
  136. ]" calculate-scheme-indent integerp /= delete-region] 24))
  137.